<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui, viewport-fit=cover">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <title>My App</title>
    <link rel="stylesheet" href="../../packages/core/css/framework7.min.css">
    <link rel="stylesheet" href="../../css/framework7-icons.css">
  </head>
  <body>
    <div id="app"></div>
    <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
    <script src="https://unpkg.com/react@16.4.1/umd/react.production.min.js"></script>
    <script src="https://unpkg.com/react-dom@16.4.1/umd/react-dom.production.min.js"></script>
    <script src="../../packages/react/framework7-react.min.js"></script>
    <script src="../../packages/core/js/framework7.min.js"></script>
    <script type="text/babel">
      class AppComponent extends React.Component {
        constructor() {
          super();
      
          this.state = {
            mounted: false,
            photos: [
              'http://placekitten.com/800/800',
              'http://placekitten.com/1024/1024',
            ],
          };
        }
        componentDidMount() {
          setTimeout(() => {
            this.setState({
              mounted: true
            })
          }, 100);
      
        }
        render() {
          return (
            <App>
              <View main>
                <Page>
                  <Navbar title="Photo Browser"></Navbar>
                  <Block>
                    <p>Photo Browser is a standalone and highly configurable component that allows to open window with photo viewer and navigation elements with the following features:</p>
                    <ul>
                      <li>Swiper between photos</li>
                      <li>Multi-gestures support for zooming</li>
                      <li>Toggle zoom by double tap on photo</li>
                      <li>Single click on photo to toggle Exposition mode</li>
                    </ul>
                  </Block>
                  <Block>
                    <p>Photo Browser could be opened in a three ways - as a Standalone component (Popup modification), in Popup, and as separate Page:</p>
                    <Row>
                      <Col>
                        <PhotoBrowser routableModals={false} photos={this.state.photos} ref={(el) => {this.standalone = el}} />
                        <Button raised onClick={() => this.standalone.open()}>Standalone</Button>
                      </Col>
                      <Col>
                        <PhotoBrowser routableModals={false} photos={this.state.photos} type="popup" ref={(el) => {this.popup = el}} />
                        <Button raised onClick={() => this.popup.open()}>Popup</Button>
                      </Col>
                      {this.state.mounted && (
                        <Col>
                          <PhotoBrowser routableModals={false} photos={this.state.photos} type="page" backLinkText="Back" ref={(el) => {this.page = el}} />
                          <Button raised onClick={() => this.page.open()}>Page</Button>
                        </Col>
                      )}
                    </Row>
                  </Block>
                  <Block>
                    <p>Photo Browser suppots 2 default themes - default Light (like in previous examples) and Dark theme. Here is a Dark theme examples:</p>
                    <Row>
                      <Col>
                        <PhotoBrowser routableModals={false} photos={this.state.photos} theme="dark" ref={(el) => {this.standaloneDark = el}} />
                        <Button raised onClick={() => this.standaloneDark.open()}>Standalone</Button>
                      </Col>
                      <Col>
                        <PhotoBrowser routableModals={false} photos={this.state.photos} theme="dark" type="popup" ref={(el) => {this.popupDark = el}} />
                        <Button raised onClick={() => this.popupDark.open()}>Popup</Button>
                      </Col>
                      {this.state.mounted && (
                        <Col>
                          <PhotoBrowser routableModals={false} photos={this.state.photos} theme="dark" type="page" backLinkText="Back" ref={(el) => {this.pageDark = el}} />
                          <Button raised onClick={() => this.pageDark.open()}>Page</Button>
                        </Col>
                      )}
                    </Row>
                  </Block>
                </Page>
              </View>
            </App>
          )
        }
      }
    </script>
    <script>
      var theme = 'ios';
      if (location.href.indexOf('theme=md') >= 0) theme = 'md';
      
      if (Framework7.use) Framework7.use(Framework7React, { theme: theme });
      else if (Framework7.Class && Framework7.Class.use) Framework7.Class.use(Framework7React, { theme: theme });
      
      var plugin = {
        params: {
          theme: theme,
        }
      };
      
      if (Framework7.use) Framework7.use(plugin);
      else if (Framework7.Class && Framework7.Class.use) Framework7.Class.use(plugin);
      
      window.onload = function () {
        if (typeof AppComponent !== 'undefined') {
          ReactDOM.render(
            React.createElement(AppComponent),
            document.getElementById('app')
          );
        }
      }
    </script>
  </body>
</html>